package com.ruoyi.web.controller.business;

import com.ruoyi.business.domain.Shaftspecifications;
import com.ruoyi.business.service.IShaftspecificationsService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 转子查询Controller
 * 
 * @author ruoyi
 * @date 2025-03-19
 */
@RestController
@RequestMapping("/business/shaftspecifications")
public class ShaftspecificationsController extends BaseController
{
    @Autowired
    private IShaftspecificationsService shaftspecificationsService;

    /**
     * 查询转子查询列表
     */
    @PreAuthorize("@ss.hasPermi('business:shaftspecifications:list')")
    @GetMapping("/list")
    public TableDataInfo list(Shaftspecifications shaftspecifications)
    {
        startPage();
        List<Shaftspecifications> list = shaftspecificationsService.selectShaftspecificationsList(shaftspecifications);
        return getDataTable(list);
    }

    /**
     * 导出转子查询列表
     */
    @PreAuthorize("@ss.hasPermi('business:shaftspecifications:export')")
    @Log(title = "转子查询", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Shaftspecifications shaftspecifications)
    {
        List<Shaftspecifications> list = shaftspecificationsService.selectShaftspecificationsList(shaftspecifications);
        ExcelUtil<Shaftspecifications> util = new ExcelUtil<Shaftspecifications>(Shaftspecifications.class);
        util.exportExcel(response, list, "转子查询数据");
    }

    /**
     * 获取转子查询详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:shaftspecifications:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(shaftspecificationsService.selectShaftspecificationsById(id));
    }

    /**
     * 新增转子查询
     */
    @PreAuthorize("@ss.hasPermi('business:shaftspecifications:add')")
    @Log(title = "转子查询", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Shaftspecifications shaftspecifications)
    {
        return toAjax(shaftspecificationsService.insertShaftspecifications(shaftspecifications));
    }

    /**
     * 修改转子查询
     */
    @PreAuthorize("@ss.hasPermi('business:shaftspecifications:edit')")
    @Log(title = "转子查询", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Shaftspecifications shaftspecifications)
    {
        return toAjax(shaftspecificationsService.updateShaftspecifications(shaftspecifications));
    }

    /**
     * 删除转子查询
     */
    @PreAuthorize("@ss.hasPermi('business:shaftspecifications:remove')")
    @Log(title = "转子查询", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(shaftspecificationsService.deleteShaftspecificationsByIds(ids));
    }
}
